<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="商品信息管理">
<body class="input">

<script type="text/javascript">


    $().ready(function () {

        var $validateErrorContainer = $("#validateErrorContainer");
        var $validateErrorLabelContainer = $("#validateErrorContainer ul");
        var $validateForm = $("#inputForm");
        var $tab = $("#tab");

        // Tab效果
        $tab.tabs(".tabContent", {
            tabs:"input"
        });

        // 表单验证
        $validateForm.validate({
            errorContainer:$validateErrorContainer,
            errorLabelContainer:$validateErrorLabelContainer,
            wrapper:"li",
            errorClass:"validateError",
            ignoreTitle:true,
            rules:{
                "goods.goodsId":{
                    required:true
                },
                "goods.goodsCategoryId":{
                    required:true
                },
                "goods.goodsName":{
                    required:true
                },
                "goods.brandName":{
                    required:true
                },
                "goods.supplyId":{
                    required:true
                },
                "goods.originalGoodsId":{
                    required:true
                }
            },
            messages:{
                "goods.goodsId":{
                    required:"商品编号不能为空！"
                },
                "goods.goodsCategoryId":{
                    required:"商品品牌不能为空！"
                },
                "goods.goodsName":{
                    required:"商品名称不能为空！"
                },
                "goods.brandName":{
                    required:"品牌名称不能为空！"
                },
                "goods.supplyId":{
                    required:"请选择供应商！"
                },
                "goods.originalGoodsId":{
                    required:"请输入供应商商品编号！"
                }
            },
            submitHandler:function (form) {
                //$(form).find(":submit").attr("disabled", true);
                form.submit();
            }
        });
        <#if actionErrors?? && (actionErrors?size > 0)>
            $.messager.show("提示信息", "<#list errorMessages as list>${list}<br></#list>", 2000);
        </#if>
    });

</script>

<div class="body">
    <div class="inputBar">
        <h1><span class="icon">&nbsp;</span>添加商品供应信息</h1>
    </div>
    <div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
        <div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
        <ul></ul>
    </div>
    <form id="inputForm" class="validate"
          action="${web_base}/game/goods!saveGoodsSupply.htm"
          method="post">
        <ul class="tab">
            <li>
                <input type="button" value="基本信息" hidefocus="true"/>
            </li>
        </ul>
        <input type="hidden" name="goods.id" class="formText" value="${(goods.id)!}"/>
        <table class="inputTable tabContent">
            <tr>
                <th>
                    商品编号:
                </th>
                <td>
                    <input type="text" name="goods.goodsId" class="formText {required: true}"
                           value="${(goods.goodsId)!}" disabled="disabled"/>
                    <input type="hidden" name="goods.goodsId" class="formText {required: true}"
                           value="${(goods.goodsId)!}"/>
                </td>
            </tr>

            <tr>
                <th>
                    商品名称：
                </th>
                <td>
                    <input type="text" name="goods.goodsName" class="formText {required: true}"
                           value="${(goods.goodsName)!}" disabled="disabled"/>
                    <input type="hidden" name="goods.goodsName" class="formText {required: true}"
                           value="${(goods.goodsName)!}"/>
                </td>
            </tr>
            <tr>
                <th>
                    品牌编号:
                </th>
                <td>
                    <input type="text" name="goods.goodsCategoryId" class="formText {required: true}"
                           value="${(goods.goodsCategoryId)!}" disabled="disabled"/>
                    <input type="hidden" name="goods.goodsCategoryId" class="formText {required: true}"
                           value="${(goods.goodsCategoryId)!}"/>
                </td>
            </tr>
            <tr>
                <th>
                    品牌名称:
                </th>
                <td>
                    <input type="text" name="goods.brandName" class="formText {required: true}"
                           value="${(goods.brandName)!}" disabled="disabled"/>
                    <input type="hidden" name="goods.brandName" class="formText {required: true}"
                           value="${(goods.brandName)!}"/>
                </td>
            </tr>
            <tr>
                <th>
                    供应商名称:
                </th>
                <td>
                    <select name="goods.supplyId" class="formText {required: true}">
                        <option value="">请选择...</option>
                        <#if supplyList??>
                            <#list supplyList as obj>
                                <option value="${obj.supplyId!}">${obj.supplyName!}</option>
                            </#list>
                        </#if>
                    </select>
                    <label class="requireField">*</label>
                </td>
            </tr>
            <tr>
                <th>
                    供应商商品编号:
                </th>
                <td>
                    <input type="text" name="goods.originalGoodsId" class="formText {required: true}" />
                    <label class="requireField">*</label>
                </td>
            </tr>
            <tr>
                <th>
                    备注：
                </th>
                <td>
                    <textarea name="goods.remark" class="formTextarea">${(goods.remark)!}</textarea>
                </td>
            </tr>
        </table>
        <div class="buttonArea">
            <input type="submit" class="formButton"  value="新   增" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回"
                   hidefocus="true"/>
        </div>
    </form>
</div>
</body>
</@edit>
